package com.uzai.common.enums.mini;

import java.util.Objects;

/**
 * The enum Mini order status.
 *
 * @author mingyang.chen create in 2023/11/1 17:09
 */
public enum MiniGoodsInvalidStatus {

    NORMAL(0, "正常"),
    /**
     * 不展示
     */
    NO_SHOW(1, "不展示"),
    /**
     * 下架
     */
    DOWN(2, "商品已下架"),
    /**
     * 过期
     */
    EXPIRE(3, "商品未上架"),
    /**
     * 库存不足
     */
    NO_STOCK(4, "商品已售罄"),
    ;

    private final Integer code;
    private final String desc;

    MiniGoodsInvalidStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static MiniGoodsInvalidStatus getByCode(Integer code) {
        for (MiniGoodsInvalidStatus value : MiniGoodsInvalidStatus.values()) {
            if (Objects.equals(value.code, code)) {
                return value;
            }
        }
        return null;
    }
}
